<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <canvas id="canvas" width="200" height="200"></canvas>
    <script>
        /* 路径:就是一段连续坐标的集合
         */
        /* 1、获取canvas */
        const canvas = document.getElementById("canvas");
        /* 2、获取绘制上下文 */
        const ctx = canvas.getContext("2d");
        /* 路径 */
        ctx.lineWidth=5;
        ctx.moveTo(0,0);
        ctx.lineTo(100,100);
        ctx.strokeStyle="#ff2d51";
        ctx.stroke()
    </script>
</body>
</html>